package com.etone.smartAudit.controller;

import com.etone.smartAudit.annotation.LoginAdmin;
import com.etone.smartAudit.domain.Admin;
import com.etone.smartAudit.domain.BuildData;
import com.etone.smartAudit.dto.buildOn.BuildOnDto;
import com.etone.smartAudit.service.BuildOnService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@AllArgsConstructor
@RestController
@Api(tags = "建审系统对接", value = "buildOn")
public class BuildOnController {

    @Autowired
    private BuildOnService buildOnService;

    @GetMapping("/buildOn/data")
    @ApiOperation(value = "获取建审系统数据", tags = "buildOn")
    public String getBuildData(@ApiIgnore @LoginAdmin Admin admin
            , BuildOnDto dto) {

        return buildOnService.getBuildData(admin, dto);
    }

    @GetMapping("/buildOn/list")
    @ApiOperation(value = "获取建审系统数据(全部)", tags = "buildOn")
    public List<BuildData> getList() {
        return buildOnService.getList();
    }

    @GetMapping("/buildOn/buildOn")
    @ApiOperation(value = "刷新数据", tags = "buildOn")
    public void buildOn() {
        buildOnService.getBuildOn();
    }

}
